from easydict import EasyDict
import rospy
import sys, os
sys.path.append(os.path.dirname(__file__))
from detector import Detector

if __name__ == "__main__":
    
    rospy.init_node('detect_node')

    # get params
    input_dict = EasyDict()
    input_dict.topic = rospy.get_param("pointcloud_topic")
    input_dict.lidar_frame = rospy.get_param("lidar_name")
    input_dict.model_cfg = rospy.get_param('~model_cfg')
    input_dict.dataset_cfg = rospy.get_param('~dataset_cfg')
    input_dict.ckpt_file = rospy.get_param('~ckpt_file')
    input_dict.score_threshold = rospy.get_param('~score_threshold')
    input_dict.z_offset = rospy.get_param('~z_offset')
    input_dict.use_intensity = rospy.get_param('~use_intensity')
    detector = Detector(input_dict)
    rospy.spin()

    
    # input_dict.cfg_file = root_path / "config/pv_rcnn.yaml"#172ms效果差
    # input_dict.ckpt_file = root_path / "config/pv_rcnn.pth"
    # input_dict.cfg_file = root_path / "config/voxel_rcnn.yaml"#67ms效果较好cpu5G,gpu2.22G 
    # input_dict.ckpt_file = root_path / "config/voxel_rcnn.pth"
    # input_dict.cfg_file = root_path / "config/pointpillar.yaml"#46.5ms效果较好cpu4.5G，gpu2.2G
    # input_dict.ckpt_file = root_path / "config/pointpillar.pth"
    # input_dict.cfg_file = root_path / "config/second_iou.yaml"#66ms效果较好cpu5G, gpu2.25
    # input_dict.ckpt_file = root_path / "config/second_iou.pth"

    # input_dict.dummy_cloud = root_path / "config/000000.bin"

    # detector = object_detection(input_dict)
